package com.seveneight.baijiesteward.utils;

import android.app.Activity;
import android.content.Context;

import com.afollestad.materialdialogs.MaterialDialog;
import com.seveneight.baijiesteward.R;

/**
 * Created by user1 on 2018/2/23.
 */

public class MDialog {
    private MaterialDialog.Builder builder;
    private MaterialDialog dialog;

    public MDialog(Context context, String content) {
        builder = new MaterialDialog.Builder(context)
                .content(content)
                .backgroundColorRes(R.color.white)
                .cancelable(false)
                .widgetColorRes(R.color.mainblue)
                .contentColorRes(R.color.mainblue)
                .progress(true, 0)
                .progressIndeterminateStyle(false);
        dialog = builder.build();
    }

    public void showLoadingDialog() {
        dialog.show();
    }

    public void hideDialog() {
        if (dialog.isShowing()) {
            dialog.dismiss();
        }
    }
}
